 <script>
	import {
		mapActions,
		mapGetters
	} from "vuex";
	import {
		shareLevel
	} from "@/utils/api";
	export default {
		computed: {
			...mapGetters(["userInfo", "shareId"]),
		},
		onLaunch: function({
			query
		}) {
			// 分享Id
			query.user_id && this.saveShareId(query.user_id);
			console.log("分享Id=========", query);
			console.log("App Launch");
			if (uni.getStorageSync("token")) {
				this.setUserInfo().then(() => {
					// this.setOrderAddress(this.userInfo.city);
					if (this.shareId) {
						shareLevel({
							id: this.shareId,
						}).then((resp) => {
							console.log("用户上下级绑定", resp);
						});
					}
				});
			}
			this.initConfig()
		},
		onShow: function() {
			console.log("App Show");
			if (uni.getStorageSync("token")) {
				if (this.shareId) {
					shareLevel({
						id: this.shareId,
					}).then((resp) => {
						console.log("用户上下级绑定", resp);
					});
				}
			}
		},
		onHide: function() {
			console.log("App Hide");
		},
		methods: {
			...mapActions(["setUserInfo", "setOrderAddress", "saveShareId"]),
			...mapActions('common', ['initConfig']) 
		},
	};
</script>

<style>
	/*每个页面公共css */
	/* 
	 https://xyshop.outletds.com/img/abandon.jpg
	 https://xyshop.outletds.com/img/activity-bg.jpg
	 https://xyshop.outletds.com/img/success.jpg
	 https://xyshop.outletds.com/img/bg.jpg
	 https://xyshop.outletds.com/img/iconfont-weapp.css
	 */
	.flex {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.border::before {
		content: "";
		position: absolute;
		width: 100%;
		height: 1rpx;
		border-bottom: 1rpx solid #e4e4e4;
		transform: scaleZ(45deg);
		left: 0;
		bottom: 0;
	}
</style>
<style lang="scss">
	// @import "https://xyshop.outletds.com/img/iconfont-weapp.css";
	@import "./static/iconfont-weapp.css";
	@import "./static/css/style.scss";
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
</style>
